
package com.example.swordjava;


import android.os.Build;

import androidx.annotation.RequiresApi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class Test75 {

    public static void main(String[] args) {

        int[][] aa = {{1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12},
                {13, 14, 15, 16}};

        int a = 1;
        int b = 4;
        int c = 4 * (b - a) / 2;

        System.out.println(Math.pow(1, 10));
        System.out.println(c);

    }

    public class TreeNode {
        int val = 0;
        TreeNode left = null;
        TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;

        }
    }

    /**
     * JZ75 字符流中第一个不重复的字符
     */

    StringBuilder sb = new StringBuilder();
    Map<Character, Integer> map = new HashMap<>();

    @RequiresApi(api = Build.VERSION_CODES.N)
    public void Insert(char ch) {
        sb.append(ch);
        map.put(ch, map.getOrDefault(ch, 0) + 1);
    }

    //return the first appearence once char in current stringstream
    public char FirstAppearingOnce() {

        for (int i = 0; i < sb.length(); i++) {
            char c = sb.charAt(i);
            if (map.get(c) == 1) {
                return c;
            }
        }
        return '#';
    }

}














